#include <stdlib.h>

#include "CuTest.h"

#include "test_sprout.h"
#include "sprout.h"
#include "sprout_util.h"

void test_c_object_to_json_object_empty(CuTest *tc)
{
    const char *ex = "{}";
    Object obj = {};
    char *ac = c_object_to_json_object(&obj);
    CuAssertStrEquals(tc, ex, ac);
    free_memory(ac);
}

void test_json_object_to_c_object_empty(CuTest *tc)
{
    char *use = read_file("./tests/data/object_empty.json");
    const char *use_ = use;
    Object *ac = json_object_to_c_object(&use_);
    CuAssertPtrNotNull(tc, ac);
    CuAssertPtrEquals(tc, NULL, ac->value);
    free_object(ac);
    free_memory(use);
}

CuSuite *test_object_suite()
{
    CuSuite *suite = CuSuiteNew();
    SUITE_ADD_TEST(suite, test_c_object_to_json_object_empty);
    SUITE_ADD_TEST(suite, test_json_object_to_c_object_empty);
    return suite;
}
